import java.util.ArrayList;


public class VRP extends TravelingSalesMan{
	NearestNeigbour nn = new NearestNeigbour(); 
	
	public void init(){
		//int array[][] =  new int [7][7];
		//array = getInput(7,7,"src/Inputs/input.txt");
		//this.noobestAssignment(array, 4);
	}
	
	public void solve(double[][] array, int numVehicle,Route route){
		//insert method here
		this.noobestAssignment(array, numVehicle, route);
	}
	
	
	@SuppressWarnings("unchecked")
	public  void noobestAssignment(double [][] array, int numVehicle, Route route) {
		ArrayList <Integer> list =  nn.solve(array, array.length, array[0].length);
	    @SuppressWarnings("rawtypes")
		ArrayList  [] truckRoutes  = new  ArrayList [numVehicle];
		
	    for(int i = 0;i<truckRoutes.length;i++)
			truckRoutes[i] = new ArrayList <Integer>();
	    
	    int quotient = (array.length-1)/numVehicle;
		int remainder = (array.length-1)%numVehicle;
		int remCnt = 0;
		int index = 1;
		for(int i =0; i< numVehicle; i++){
			System.out.print("For truck # "+(i+1)+" depot");
			truckRoutes[i].add(0);
			remCnt = remainder>0?1:0;
			for(int j = 0;j< quotient +remCnt;j++,index++){
				System.out.print("-> "+list.get(index));
				truckRoutes[i].add(list.get(index));
			}
			remainder--;
			System.out.println();

		}
		
		route.list = truckRoutes;
	}



	
	

}
